home *** CD-ROM | disk | FTP | other *** search
- Rem Project: Planet Potter
- Rem Created: 25/07/2002 15:38:30
-
- rem Initialise
- sync on : sync rate 60
- set text font "Arial" : set text size 20
- set text to bold : set text transparent
-
- rem Load environment
- load object "media\moonlit\ml.x",100
- scale object 100,20,20,20
- set object cull 100,0
- set object light 100,0
- set object texture 100,2,1
-
- rem Load nine planets
- for p=1 to 9
- load object "media\planet\planet.x",p
- position object p,(p-3)*350,0,500
- hide object p
- next p
-
- rem Load tenth planet for home
- load object "media\planet\planet.x",10
- position object 10,0,-150,-350
- rotate object 10,0,0,90
-
- rem Load particle image
- load image "media\gfx\fire.bmp",1
-
- rem Load player sounds
- load sound "media\sounds\shoot.wav",1
-
- rem Load game sounds
- load sound "media\sounds\appear.wav",11
- for s=12 to 19 : clone sound s,11 : next s
- load sound "media\sounds\explode.wav",21
- for s=22 to 29 : clone sound s,21 : next s
-
- rem Setup camera and light
- set camera range 0.1,3000
- set point light 0,-50,80,-600
- set light range 0,2000
-
- rem Starting rate
- prate=150
-
- rem Game loop
- do
-
- rem Control player cursor and shot
- if mouseclick()=1 and guncool=-1
- rem Shoot effect
- play sound 1 : guncool=3
- rem Detect good hit
- for p=1 to 9
- if object visible(p)=1 and object angle z(p)=0
- sx=object screen x(p)
- sy=object screen y(p)
- mx=mousex() : my=mousey()
- if mx>sx-100 and mx<sx+100 and my>sy-100 and my<sy+100
- zrotate object p,1
- play sound 20+p
- endif
- endif
- next p
- endif
- if guncool=0 and mouseclick()=0 then guncool=-1
- if guncool>0 then dec guncool
-
- rem Control planets
- gosub _newplanets
- gosub _moveplanets
-
- rem Rotate sky backdrop and home planet
- yrotate object 100,wrapvalue(object angle y(100)+0.1)
- yrotate object 10,wrapvalue(object angle y(10)-0.05)
-
- rem Stats
- inc points
- prompt$="SCORE: "+str$(points)
- center text screen width()-text width(prompt$),screen height()-40,prompt$
-
- rem Update screen
- sync
-
- rem End loop
- loop
- end
-
- _newplanets:
-
- if pmaker>0 then dec pmaker
- if pmaker=0
- p=1 : while object visible(p)=1 and p<9 : inc p : endwhile
- x=rnd(2000)-1000
- y=rnd(1500)-500
- position object p,x,y,1000
- scale object p,100,100,100
- rotate object p,0,0,0
- ghost object off p
- play sound 10+p
- show object p
- pmaker=prate+rnd(prate/2)
- if prate>30 then dec prate,20
- endif
-
- return
-
- _moveplanets:
-
- rem Move all planets
- for p=1 to 9
- position object p,object position x(p)/1.01,object position y(p)/1.01,object position z(p)-10
- yrotate object p,wrapvalue(object angle y(p)+1)
- if object position z(p)<-600 then hide object p
- next p
-
- rem Handle planet destruction
- for p=1 to 9
- if object angle z(p)>0 and object visible(p)=1
- s=50-object angle z(p)
- ghost object on p,2
- scale object p,s*2,s*2,s*2
- zrotate object p,object angle z(p)+1
- if object angle z(p)>70
- hide object p
- endif
- endif
- next p
-
- return
-
-
-
-